﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <link rel="stylesheet" href="/stylesheets/bolao2010.css" type="text/css"> 
    <meta content="text/html; charset=UTF-8" http-equiv="content-type">
    <title>{% block title %}{% endblock %}</title>
</head>
    <body>
        <script type="text/javascript">

          var _gaq = _gaq || [];
          _gaq.push(['_setAccount', 'UA-16709319-1']);
          _gaq.push(['_trackPageview']);

          (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
          })();

        </script>
        
        {% if bolao.exibe_contagem %}
        <script>
        /*
        Count down until any date script-
        By JavaScript Kit (www.javascriptkit.com)
        Over 200+ free scripts here!
        */


        //change the text below to reflect your own,
        var current="Today is Christmas. Merry Christmas!"
        var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

        function countdown(futurestring){
            /* Lixo */
            yr=2050;m=08,d=29,h=17,min=00,sec=00
            theyear=yr;themonth=m;theday=d;
            thehour=h;themin=min;thesec=sec;

            /* todaystring */
            var today=new Date()
            var todayy=today.getYear()
            if (todayy < 1000)
                todayy+=1900
            var todaym=today.getMonth()
            var todayd=today.getDate()
            var todayh=today.getHours()
            var todaymin=today.getMinutes()
            var todaysec=today.getSeconds()
            var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec

            /* calcula tempo restante */
            /* var futurestring="Jun 10 2010 23:59:59" */
            dd=Date.parse(futurestring)-Date.parse(todaystring)
            dday=Math.floor(dd/(60*60*1000*24)*1)
            dhour=24*dday+Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
            dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
            dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
            if(dday<=0&&dhour<=0&&dmin<=1&&dsec<=1){
                document.forms.count.count2.value="segundos..."
                return
            }
            else
                document.forms.count.count2.value=""+dhour+"h "+dmin+"m "+dsec+"s"
                setTimeout("countdown(futurestring)",1000)
        }
        </script>
        {% endif %}
        
        
        <table class="menu">
            <colgroup style="width: 50%;"></colgroup> 
            <colgroup style="width: 50%;"></colgroup> 
            <tbody>
                <tr class="cor=blue" >
                    <td class="left">
                        <a href="/">Meus participantes</a> |
                        <a href="/participantes">Participantes</a> |
                        <a href="/palpites">Palpites</a> |
                        <a href="/secacao"><span style="color: red;">Secação</span></a> |
                        <a href="/regras">Regras</a> |
                        <a href="/ranking">Ranking Geral</a> 
                        {% if bolao.em_segunda_fase %}
                        | <a href="/ranking2">Ranking 2a Fase</a>
                        {% endif %}
                    </td>
                    
                    <td class="right">
                        {{bolao.fase.nome}} |
                        {{user.email}} |
                        <a href="{{ logout_url }}">Logout</a>
                    </td>
                </tr>
            </tbody>
        </table>
    
    {% if bolao.em_manutencao %}
    <table>
        <tr><td><h2>
        <span style="color: red;">
        Pessoal: o site está em manutenção! Por favor, aguardem que em breve voltará a ficar operacional.
        </span>
        </h2></td></tr>
    </table>
    {% endif %}
    
    {% if bolao.exibe_contagem %}
    <form name="count">
        <b>Atenção: a edição de palpites se encerra em</b>: <input style="text-align:center;" type="text" size="11" name="count2">
    </form>
    <script>
    
        /* preciso deste montharray repetido aqui? ele esta no scrip acima */
        var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
    
        /* calcula futurestring, a partir da data local e do delta em milisegundos */
        var now=new Date()
        var future=new Date(now.getTime() + {{bolao.tempo_de_edicao}})
        var futurey=future.getYear()
        if (futurey < 1000)
            futurey+=1900
        var futurem=future.getMonth()
        var futured=future.getDate()
        var futureh=future.getHours()
        var futuremin=future.getMinutes()
        var futuresec=future.getSeconds()
        var futurestring=montharray[futurem]+" "+futured+", "+futurey+" "+futureh+":"+futuremin+":"+futuresec
    
        countdown(futurestring)
    </script>
    {% endif %}

    {% if eh_convidado %}
        <div id="content">
            {% block content %}{% endblock %}
        </div>
    {% else %}
        <p>"Opa! Você não foi convidado. ({{user.email}})"</p>
    {% endif %}
    </body>
</html>